#include "Sort.h"

void TestBubbleSort(void)
{
	int a[] = { 2,4,1,7,8,3,9,2 };

	PrintArray(a, sizeof(a) / sizeof(a[0]));
	BubbleSort(a, sizeof(a) / sizeof(a[0]));
	PrintArray(a, sizeof(a) / sizeof(a[0]));
}

void TestInsertSort(void)
{
	//int a[] = { 2,4,1,7,8,3,9,2 };
	int a[] = { 6, 1, 2, 7, 9, 3, 4, 5, 10, 8 };

	PrintArray(a, sizeof(a) / sizeof(a[0]));
	InsertSort(a, sizeof(a) / sizeof(a[0]));
	PrintArray(a, sizeof(a) / sizeof(a[0]));
}

void TestQuickSort(void)
{
	int a[] = { 6, 1, 2, 7, 9, 3, 4, 5, 10, 8 };

	PrintArray(a, sizeof(a) / sizeof(a[0]));
	QuickSort(a, 0, sizeof(a) / sizeof(a[0])-1);
	PrintArray(a, sizeof(a) / sizeof(a[0]));
}

void TestQuickSortNonR(void)
{
	int a[] = { 6, 1, 2, 7, 9, 3, 4, 5, 10, 8 };

	PrintArray(a, sizeof(a) / sizeof(a[0]));
	QuickSortNonR(a, 0, sizeof(a) / sizeof(a[0]) - 1);
	PrintArray(a, sizeof(a) / sizeof(a[0]));
}

int main()
{
	printf("BubbleSort:\n");
	TestBubbleSort();
	putchar('\n');
	//TestInsertSort();

	printf("QuickSort:\n");
	TestQuickSort();
	putchar('\n');

	printf("QuickSortNonR:\n");
	TestQuickSortNonR();
	putchar('\n');
	
	return 0;
}